﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using ca2simulator.server.console.wcf;
using System.ServiceModel.Description;
using ca2simulator.shared.wcf;

namespace ca2_simulation_server_console
{
    class Program
    {
        const string ADDR = "net.tcp://localhost:8730/";

        public static void Main(string[] args)
        {
            
            //Create the service: http://msdn.microsoft.com/en-us/library/ms730935.aspx
            Uri baseAddress = new Uri(ADDR);
            ServiceHost selfHost = new ServiceHost(typeof(CA2Service), baseAddress);
            try
            {
                //Open the service
                selfHost.Open();
                Console.WriteLine("The service is ready.");
                Console.WriteLine("Press <ENTER> to terminate service.");
                Console.WriteLine();
                Console.ReadLine();

                // Close the ServiceHostBase to shutdown the service.
                selfHost.Close();
            }
            catch (CommunicationException ce)
            {
                Console.WriteLine("An exception occured: {0}", ce.Message);
                selfHost.Abort();
            }
             


        }
    }
}
